home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_056
/
mcad
/
tdp
/
tdp.doc
< prev
next >
Wrap
Text File
|
1992-05-06
|
5KB
|
99 lines
**************************************************************************
THIS SOFTWARE IS IN THE PUBLIC DOMAIN. IT IS INTENDED TO
BE AVAILABLE FREE TO WHOMEVER WANTS IT. YOU MAY USE AND
DISTRIBUTE IT AS YOU LIKE WITH THE FOLLOWING RESTRICTIONS:
1) You may not sell this software or charge more than a
small copying/hassle fee for distributing it.
2) Don't remove this notice from the distribution.
Tim Mooney
120 Purefoy Rd.
Chapel Hill, NC 27514
also:
Physics Dept.
Phillips Hall
University of NC
Chapel Hill, NC 27514
****************************************************************************
tdp.c - 3-D DATA VIEWING ROUTINE
Tdp displays the projection on the x-y plane of a function z(x,y).
The function must be single-valued, and defined on a regular x-y grid.
------------------------------------------------------------------------
To get a quick idea of what is going on here, drop a net over a
chessboard in the middle of a game: the heights of the various pieces
are the z coordinates; the positions (row, column) of the pieces are
the (x, y) coordinates. Tdp draws a picture of the net.
Continuing with the chessboard analogy: tdp first wants to know how
many rows and columns of data to expect. Then it wants z coordinates,
starting with the row nearest you, from left to right, to the row
nearest your opponent. Further, tdp wants all of this in a binary
file: 4-byte-int (# rows); 4-byte-int (# columns); 4-byte-floats (z
coordinates). Tdp does NOT want x or y coordinates in the data file.
(The program t2f exists to convert a text file of z-data to a binary
file tdp will plot. The user supplies the number of rows and columns
on the command line.)
You tell tdp from what viewing point you wants to see the net.
Imagine looking at the board "edge-on" -- your eyes level with the
table -- and facing your opponent. Tdp calls this position
"phi = 0 degrees, theta = 0 degrees". If you rotate the board clock-
wise (as seen from above) on the table, you are increasing phi to some
positive value. Now with phi fixed, tilt the table toward you so that
the pieces would fall in your lap. To tdp, this decreases theta to
some negative angle; it gives you a view of the top of the board.
(You math folks will have recognized that phi and theta are Euler
angles.) The viewing distance is hardwired in (variable "dist" in
the function calc().)
Tdp uses a very simple algorithm for hidden-line removal: lines are
plotted from the bottom of the screen up; for each possible horizontal
position, a record is kept of the topmost point plotted so far. This
algorithm is suitable for binned data, chessboards viewed from above,
and the like. A command line option ("-b") allows a "bottom view " of
the data set to be displayed also; the same algorithm is used in reverse.
BUGS: Occasionally, tdp will draw a stray line when phi is set to 0
or a multiple of 90 degrees. I haven't found the offending piece of
code yet. Since translation to Lattice 3.1, axes are weird, don't use.
**************************************************************************
Tdp is loosely based on a program originally written in FORTRAN on
the VAX at Triangle Universities Nuclear Laboratory. The program used
low level GRZ (TM of Bell Labs) calls to plot on a Tektronix graphics
terminal. Since the only AMIGA graphics routines really required are
Move(), and Draw(), it should be fairly easy to port this program around.
One more thing: in several places, tdp assumes that ints and floats
are the same size. This saves time and memory for the executable, but
it's still an unfriendly thing to do. Sorry about that.
*************************************************************************
MENUS:
There is one menu with the following choices:
Open not implemented
Mk Plot File While generating the NEXT plot, tdp will write a file
which can be sent ("Copy myplotfile TO ser:") to any plotter
that understands HPGL, the Hewlett Packard Graphics Language.
Commands in the plot file instruct the (serial interface)
plotter to use xON/xOFF.
Mk mCAD File While generating the NEXT plot, tdp will write a file
compatible with "mCAD", a shareware object-oriented drawing
program.
Quit Closes hi-res screen and returns you to the command line.
The program asks if you want to continue this plot -- e.g.,
to select another set of viewing angles. If you don't,
tdp exits.